﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DataAccessLayer.Entity;
namespace DataAccessLayer.Adapter
{
    public class DotTuyenSinhAdapter
    {
        clsKetNoiCSDL kn = new clsKetNoiCSDL();
        public DataTable LoadDotTS()
        {
            return kn.LoadDL("tbDotTS_SelectAll");
        }
        //thêm: tbDotTS_Insert
        public void ThemDotTS(clsDotTuyenSinh clsDotTS)
        {
            int Npa = 3;
            string sql = "tbDotTS_Insert";
            string []name=new string[Npa];
            object []value=new object[Npa];
            name[0] = "@MaDTS"; value[0] = clsDotTS.MaDotTS;
            name[1] = "@NamTS"; value[1] = clsDotTS.NamTuyenSinh;
            name[2] = "@TenDotTS"; value[2] = clsDotTS.TenDotTuyenSinh;
            kn.UpdateDL(sql,name,value,Npa);
        }

        //sửa: tbDotTS_Update
        public void SuaDotTS(clsDotTuyenSinh clsDotTS)
        {
            int Npa = 3;
            string sql = "tbDotTS_Update";
            string[] name = new string[Npa];
            object[] value = new object[Npa];
            name[0] = "@MaDTS"; value[0] = clsDotTS.MaDotTS;
            name[1] = "@NamTS"; value[1] = clsDotTS.NamTuyenSinh;
            name[2] = "@TenDotTS"; value[2] = clsDotTS.TenDotTuyenSinh;
            kn.UpdateDL(sql, name, value, Npa);
        }
        //xóa: tbDotTS_Delete
        public void XoaDotTS(clsDotTuyenSinh clsDotTS)
        {
            int Npa = 1;
            string sql = "tbDotTS_Delete";
            string[] name = new string[Npa];
            object[] value = new object[Npa];
            name[0] = "@MaDTS"; value[0] = clsDotTS.MaDotTS;
            //name[1] = "@NamTS"; value[1] = clsDotTS.NamTuyenSinh;
            //name[2] = "@TenDotTS"; value[2] = clsDotTS.TenDotTuyenSinh;
            kn.UpdateDL(sql, name, value, Npa);
        }
        public object KiemTraTrungMa(clsDotTuyenSinh clsDotTS)
        {
            string sql = "tbDotTS_KiemTraMa";
            int N = 1;
            string[] name = new string[N];
            object[] value = new object[N];
            name[0] = "@MaDotTS"; value[0] = clsDotTS.MaDotTS;
            return kn.KTTrungMa(sql, name, value, N);
        }
    }
}
